package com.meeting.master.entrance.web.controller;

import com.meeting.master.entrance.web.converter.RoomInfoVoConverter;
import com.meeting.master.entrance.web.query.executor.RoomInfoVoQueryExecutor;
import com.meeting.master.entrance.web.vo.RoomInfoVo;
import com.meeting.master.persist.qto.GetRoomInfoQto;
import com.meeting.master.service.RoomInfoBOService;
import com.meeting.master.service.RoomInfoDtoService;
import com.meeting.master.service.bto.CreateRoomInfoBto;
import com.vs.code.AutoGenerated;
import com.vs.common.util.rpc.pub.PublicInterface;

import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

@Controller
@Validated
@AutoGenerated(locked = false, uuid = "b2a29713-a4c0-35d2-a9bb-e80d8932a2f9")
public class MasterController {
    @AutoGenerated(locked = true)
    @Resource
    private RoomInfoBOService roomInfoBOService;

    @AutoGenerated(locked = true)
    @Resource
    private RoomInfoDtoService roomInfoDtoService;

    @AutoGenerated(locked = true)
    @Resource
    private RoomInfoVoConverter roomInfoVoConverter;

    @AutoGenerated(locked = true)
    @Resource
    private RoomInfoVoQueryExecutor roomInfoVoQueryExecutor;

    /** 获取会议室信息 */
    @PublicInterface(id = "48df1652-e1b3-432f-a023-bea19d2e85ee", version = "1732671950153")
    @AutoGenerated(locked = false, uuid = "48df1652-e1b3-432f-a023-bea19d2e85ee")
    @RequestMapping(
            value = {"/api/master/get-room-info"},
            method = {RequestMethod.POST},
            produces = {"application/json;charset=UTF-8"})
    public List<RoomInfoVo> getRoomInfo(@Valid @NotNull(message = "查询参数不能为空") GetRoomInfoQto qto) {
        /** This block is generated by vs, do not modify, start anchor 1 */
        List<RoomInfoVo> result = roomInfoVoQueryExecutor.getRoomInfo(qto);
        /** This block is generated by vs, do not modify, end anchor 1 */
        // access response
        /** This block is generated by vs, do not modify, start anchor 2 */
        return result;
        /** This block is generated by vs, do not modify, end anchor 2 */
    }

    /** 创建会议室 */
    @PublicInterface(id = "4af17ad9-5e58-491b-8d9a-26d83a4e01b3", version = "1732690760409")
    @AutoGenerated(locked = false, uuid = "4af17ad9-5e58-491b-8d9a-26d83a4e01b3")
    @RequestMapping(
            value = {"/api/master/create-room-info"},
            method = {RequestMethod.POST},
            produces = {"application/json;charset=UTF-8"})
    public RoomInfoVo createRoomInfo(@Valid CreateRoomInfoBto createRoomInfoBto) {
        /** This block is generated by vs, do not modify, start anchor 1 */
        Long id = roomInfoBOService.createRoomInfo(createRoomInfoBto);
        RoomInfoVo result =
                id == null
                        ? null
                        : roomInfoVoConverter.convertAndAssembleData(
                                roomInfoDtoService.getById(id));
        /** This block is generated by vs, do not modify, end anchor 1 */
        // access response
        return result;
    }
}
